package kr.co.graviti.sqlmap;

import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class SqlReaderXml { 
	
	private static final SqlMapClient sqlMap;
	static {
		String configUrl = "kr/co/graviti/sqlmap/sqlMapConfig.xml";	
		try {
			Reader reader = Resources.getResourceAsReader(configUrl);
			sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
			reader.close();
		} catch (Exception e) {
			throw new RuntimeException("Error initializing SqlMapObject : " + e.getMessage());
		}
	}
	 
	public static SqlMapClient getInstance() {
		return sqlMap;
	}
}
